<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 200px;
            height: 200px;
            margin: 0 auto;
            background-color: pink;
        }

        /* div::before 在前面插入元素 */
        /* div::after 在后面插入元素 */

        div::before{
            /* 必须要有的属性 */
            content: "";
            display: none;
            width: 200px;
            height: 200px;
            background-color: rgba(0, 0, 0, 0.132);
        }
        div:hover::before{
                  display: block;
        }
        
    </style>
</head>
<body>
    <div></div>
</body>
</html>